package com.example.demo.dao;

import com.example.demo.pojo.Customer;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CustomerDao extends JpaRepository<Customer, Long>, JpaSpecificationExecutor<Customer> {

    Customer findTopByName(String name);

    List<Customer> findByName(String name);

    List<Customer> findByNameLike(String name);

    Page<Customer> findByNameLike(String name, Pageable pageable);

    // 分页，根据department属性模糊查询
    Page<Customer> findByDepartmentLike(String department, Pageable pageable);
}
